﻿using Newtonsoft.Json;
using System;
using System.ComponentModel.DataAnnotations.Schema;
using YiSha.Entity.OrganizationManage;
using YiSha.Util;

namespace YiSha.Entity.Test
{
    [Table("PMC_Schedule")]
    public class ScheduleEntity : BaseModifyEntity
    {
        public DateTime Date { get; set; }

        public string WorkOrderNumber { get; set; }

        [JsonConverter(typeof(StringJsonConverter))]
        public long ProcessId { get; set; }

        public int PlanNumber { get; set; }

        public int RealNumber { get; set; }

        public string Remark { get; set; }

        [NotMapped]
        public UserEntity UserInfo { get; set; }

        /// <summary>
        /// 重写ToString方法，输出基本信息
        /// </summary>
        /// <returns>返回对象的字符串表示</returns>
        public override string ToString()
        {
            return $"ScheduleEntity [ID: {Id}] " +
                   $"工令号: {WorkOrderNumber}, " +
                   $"排产日期: {Date:yyyy-MM-dd HH:mm:ss}, " +
                   $"工序ID: {ProcessId}, " +
                   $"计划数量: {PlanNumber}, " +
                   $"实际数量: {RealNumber}, " +
                   $"客户订单号: {CustomerOrderId}, " +
                   $"客户: {Customer}, " +
                   $"项目名称: {ProjectName}, " +
                   $"交付日期: {DeliveryDate?.ToString("yyyy-MM-dd") ?? "未设置"}, " +
                   $"产品编号: {ProductOrder}, " +
                   $"订单数量: {OrderNumber}";
        }

        public string CustomerOrderId { get; set; }

        public string Customer { get; set; }

        public string ProjectName { get; set; }

        public DateTime? DeliveryDate { get; set; }

        public string ProductOrder { get; set; }

        public int? OrderNumber { get; set; }
    }
}